package toannm;

import main.pak.R;
import Service.MusicService;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MusicPlayer extends Activity implements View.OnClickListener {

    private static final String TAG = "ServicesDemo";
    Button m_cmd_start, m_cmd_stop;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_music_player);

        m_cmd_start = (Button) findViewById(R.id.v_cmd_start);
        m_cmd_stop = (Button) findViewById(R.id.v_cmd_stop);

        m_cmd_start.setOnClickListener(this);
        m_cmd_stop.setOnClickListener(this);
    }

    @Override
    public void onClick(View src) {
        switch (src.getId()) {
            case R.id.v_cmd_start:
                Log.d(TAG, "onClick: starting service");
                startService(new Intent(this, MusicService.class));
                break;
            case R.id.v_cmd_stop:
                Log.d(TAG, "onClick: stopping service");
                stopService(new Intent(this, MusicService.class));
                break;
        }
    }
}
